home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
colordh.exe
/
COLOR_AP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-01-15
|
21KB
|
599 lines
{*--------------------------------------------------------------------------*}
{* Color_App 1.3 -- add colors to your Application dialogs. *}
{* by Doug Hood. CIS 70324,3336 *}
{* Released to the PUBLIC DOMAIN. *}
{* (in a small effort to repay my debt to the PUBLIC Domain) *}
{*--------------------------------------------------------------------------*}
{* Version 1.3 adds support for BP 7.0 /TVision 2.0 *}
{* using conditional compilation for BOTH BP6.0 and BP7.0 support *}
{*--------------------------------------------------------------------------*}
{* Version 1.2 adds Color_InputLine Beeping when FULL. *}
{*--------------------------------------------------------------------------*}
{* Version 1.1 adds Color_StaticText2 (only the chars are colored) *}
{*--------------------------------------------------------------------------*}
{* To Use the COLOR features (Buttons, etc) you must: *}
{* 0: Have your application be a PCOLOR_APP from this unit!!!! *}
{* 1: Have your DIALOG be a PCOLOR_DIALOG from this unit! *}
{* 2: Pascal-Code the PCOLOR_BUTTONS/PCOLOR_STATICTEXT exactly *}
{* the same as if they were 'normal' TButton/TStaticText. *}
{* 3: My 'FIELDS_C' also unit knows about these COLOR objects. *}
{*--------------------------------------------------------------------------*}
{*--------------------------------------------------------------------------*}
{* NOTE: i am taking advantage of the upper 8 colors by disabling the *}
{* ability to 'flash' *}
{*--------------------------------------------------------------------------*}
UNIT Color_App; {Colored Application Buttons/TEXT!!}
INTERFACE
USES App, {TVISION, modified version to handle COLOR buttons!}
Dialogs, {TVISION, button}
Views, {TVision, titlestr}
Drivers, {TEvent}
Objects; {TVision, misc}
CONST
Button_Color_Default :byte = 0; {green}
Button_Black :byte = 1;
Button_Dk_Blue :byte = 2;
Button_Green :byte = 3;
Button_Cyan :byte = 4;
Button_Red :byte = 5;
Button_Purple :byte = 6;
Button_Brown :byte = 7;
Button_Grey :byte = 8;
Button_Dk_Grey :byte = 9;
Button_Lt_Blue :byte = 10;
Button_Lt_Green :byte = 11;
Button_Lt_Cyan :byte = 12;
Button_Lt_Red :byte = 13;
Button_Lt_Purple :byte = 14;
Button_Yellow :byte = 15;
Button_White :byte = 16;
{*************************************************************************}
{* TAPPLICATION (TVision) *}
{* Method:GetPalette *}
{* | *}
{* +Color_App *}
{* Method:GetPalette *}
{* Method:HandleEvent (beep when full) *}
{* *}
{* *}
{* TDIALOG (Tvision) *}
{* Method:Init (turn off blink ability to get 8 more colors) *}
{* Method:GetPalette *}
{* | *}
{* + Color_Dialog (in unit Color_App) *}
{* Method:GetPalette *}
{* *}
{* *}
{* TBUTTON (TVision) *}
{* Constructor:Init *}
{* Method:GetPalette *}
{* | *}
{* + Color_Button (in unit Color_App) *}
{* Constructor:Init (add color param) *}
{* Method:GetPalette *}
{*************************************************************************}
TYPE
PColor_InputLine = ^Color_Inputline;
Color_InputLine = OBJECT(TInputLine)
constructor Init (var Bounds: OBJECTS.TRect; AMaxLen: Integer;
Button_Color_ID : byte); {new parameter!}
function GetPalette : PPalette; virtual; {MUST Override!}
procedure HandleEvent (var Event : TEvent); virtual;
{beep when too long}
private
Color : word;
end; {color_inputline}
PColor_Button = ^Color_Button;
Color_Button = object(DIALOGS.TButton)
constructor Init (var Bounds : OBJECTS.TRect;
ATitle : VIEWS.TTitleStr;
ACommand : Word;
AFlags : Byte;
Button_Color_ID : byte); {new parameter!}
function GetPalette : PPalette; virtual; {MUST Override!}
procedure New_Color (Button_Color_ID : Byte);
function Get_Color : integer;
procedure Hide_Shadow;
private
Color : word;
Shadow_Hidden : boolean;
end; {Color_Button}
{*-----------------------------------------------------------------*}
{* The background, not the chars is colored. *}
{*-----------------------------------------------------------------*}
PColor_StaticText = ^Color_StaticText;
Color_StaticText = object(DIALOGS.TStaticText)
constructor Init (var Bounds : OBJECTS.TRect;
AText : string;
Button_Color_ID : byte); {new parameter!}
function GetPalette : PPalette; virtual; {MUST Override!}
private
Color : word;
end; {Color_StaticText}
{*-----------------------------------------------------------------*}
{* Only the chars, not the background is colored *}
{*-----------------------------------------------------------------*}
PColor_StaticText2 = ^Color_StaticText2;
Color_StaticText2 = object(Color_StaticText)
function GetPalette : PPalette; virtual; {MUST Override!}
end; {Color_StaticText2}
PColor_Dialog = ^Color_Dialog;
Color_Dialog = object(TDialog)
constructor init (var bounds: TRect; ATitle: TTitleStr);
function GetPalette : PPalette; virtual; {MUST Override!}
end; {Color_Dialog}
PColor_Application = ^Color_Application;
{this elimates need to tweak APP.pas}
Color_Application = object(TApplication)
function GetPalette : PPalette; virtual; {MUST Override!}
end; {Color_Application}
{*-----------------------------------------------------------*}
{* If you want blinking, you must call SetBlink(TRUE) *}
{* after a color dialog *}
{* NOTE: This should be called (FALSE) when returning *}
{* from a DOS_SHELL. (since another program may *}
{* haved changed the state behing my back) *}
{*-----------------------------------------------------------*}
procedure SetBlink(State: Boolean);
{*************************************************************************}
{*************************************************************************}
{*************************************************************************}
IMPLEMENTATION
{*************************************************************************}